<?php if (!defined('THINK_PATH')) exit();?><style>
    .form-group label{width: 120px}
</style>
<section class="content-header" >
    <h1>
        个人信息
        <small>修改个人信息</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="<?php echo U();?>"><i class="fa fa-user"></i> 个人信息</a></li>
        <li class="active">修改个人信息</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-danger">
                <div class="box-header">
                    <h3 class="box-title">修改个人信息</h3>
                </div>
                <div class="box-body ">
                    <form id="admin_public_editinfo_form">
                        <div class="form-group">
                            <label>用户名  <i class="fa fa-user"></i>:</label>
                            <?php echo ($info["username"]); ?>
                        </div>
                        <div class="form-group">
                            <label>最后登录时间  <i class="fa  fa-clock-o"></i>:</label>
                            <?php if(($info["lastlogintime"]) > "0"): echo (date('Y-m-d H:i:s',$info["lastlogintime"])); else: ?>-<?php endif; ?>
                        </div>
                        <div class="form-group">
                            <label>最后登录IP  <i class="fa fa-laptop"></i>:</label>
                            <?php echo ((isset($info["lastloginip"]) && ($info["lastloginip"] !== ""))?($info["lastloginip"]):'-'); ?>
                        </div>
                        <div class="form-group">
                            <label>真实姓名  <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入真实姓名" id="inputNane"
                                   class="form-control"  data-validation="length"
                                   data-validation-length="min2"
                                   name="info[realname]" value="<?php echo ($info["realname"]); ?>"  
                                   data-validation-error-msg="请输入真实姓名" data-validation-help="真实姓名应该为2-20位之间">
                        </div>
                        <div class="form-group">
                            <label>E-mail  <i class="fa fa-envelope-o"></i>:</label>
                            <input type="email" placeholder="Enter email" 
                                   data-validation-url="<?php echo U('Admin/public_checkEmail');?>"
                                   class="form-control"
                                   data-validation="email"
                                   data-validation-error-msg="E-mail格式错误"
                                   data-validation-req-params='{"default":"{$info.email}"}'
                                   data-validation-param-name="email"
                                   id ='email'
                                   name="info[email]" value="<?php echo ($info["email"]); ?>">
                        </div>
                        <div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" id='admin_public_editinfo_form_submit'>提交</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $('#admin_public_editinfo_form_submit').click(function () {
                $('#admin_public_editinfo_form').submit();
            });
            $.validate({
                modules: 'security',
                onSuccess: function () {
                    adminPublicEditinfoFormSubmit();
                    return false;
                }
            });
        });

        function adminPublicEditinfoFormSubmit() {
            $.post("<?php echo U('Admin/public_editInfo');?>",
                    $("#admin_public_editinfo_form").serialize(), function (res) {
                if (!res.status) {
                    $.messager.alert('提示信息', res.info, 'error');
                } else {
                    $.messager.alert('提示信息', res.info, 'info');
                }
            });
            return false;
        }
    </script>
</section>